package cn.topcodes.tcsf.admin.commons.api.listener;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import java.net.URL;

/**
 * Created by Unicorn on 2018/5/30.
 */
public class LogbackConfigListener implements ServletContextListener {

    @Override
    public void contextInitialized(ServletContextEvent event) {
        try {
            URL url = LogbackConfigListener.class.getResource("/logback.xml");
            System.setProperty("logback.configurationFile", url.getPath());
        }catch (Exception e) {
            e.printStackTrace();
        }
    }

    @Override
    public void contextDestroyed(ServletContextEvent event) {
    }
}
